package com.iuie.ns.system.factory;

import java.lang.reflect.Constructor;

import com.iuie.ns.system.maker.BatchMaker;

/**
 * 批量构件对象工厂
 * @author liujie
 * @date 2018年4月2日下午2:46:08
 */
public class BatchBuildeObjectFactory {

	public <T> BatchMaker<T> getMaker(String rule, String className) {
		try {
			Class<?> clazz = Class.forName(className);
			Constructor<?> cons = clazz.getConstructor(String.class);
			@SuppressWarnings("unchecked")
			BatchMaker<T> obj = (BatchMaker<T>) cons.newInstance(rule);
			return obj;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}
